#include "CCClientProcess.h"
#include "CCThread.h"
#include <unistd.h>
#include <stdio.h>

CCClientProcess::CCClientProcess()
{

}

CCClientProcess::~CCClientProcess()
{

}

void CCClientProcess::StartClientProcessWithSockfd(int sockfd)
{
    int m_clientSockfd = sockfd;

    detach_thread_create(NULL, (void *)startRecvThread, this);
    detach_thread_create(NULL, (void *)startSendThread, this);
}

void CCClientProcess::startRecvThread(long long userData)
{
    CCClientProcess* clientPtr = (CCClientProcess *)userData;
    if (clientPtr != NULL) {
        clientPtr->RunRecvProcess();
    }
}

void CCClientProcess::startSendThread(long long userData)
{
    CCClientProcess* clientPtr = (CCClientProcess *)userData;
    if (clientPtr != NULL) {
        clientPtr->RunSendProcess();
    }
}

void CCClientProcess::RunRecvProcess()
{
    while (1) {
        usleep(2000*1000);
        printf("RunRecvProcess ...\n");
    }
}

void CCClientProcess::RunSendProcess()
{
    while (1) {
        usleep(2000*1000);
        printf("RunSendProcess ...\n");
    }
}